public class LRUCache extends LinkedHashMap<Integer, Integer> {
    private int capacity;
    public LRUCache(int capacity) {
        super(16, 0.75f, true);
        this.capacity = capacity;
    }
    public Integer get(Object key) {
        Integer v = super.get(key);
        if(v != null) return v;
        else return -1;
    }
    public boolean removeEldestEntry(Map.Entry<Integer, Integer> eldest){
        return size() > capacity;
    }
    public void set(int key, int value) {
        super.put(key, value);
    }
}
